﻿@{
	Layout = null;
}

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	<title>layout 管理系统大布局 - Layui</title>
	<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
	<!-- 引入Element Plus的CSS文件 -->
</head>

<body style="position: absolute;left:40px;top:21px;">
	<div id="app">
		<el-form :model="formData" ref="addForm" label-width="110px" class="demo-ruleForm">
			<table width="90%">
				<tr>
					<td>
						<font color="black">您正在做的业务是：人力资源--权限管理--添加角色 </font>
					</td>
				</tr>
				<tr>
					<td align="right">
						<el-button style="float:right" v-on:click="submitForm()">保存</el-button>
						<el-button style="float:right" v-on:click="qc()">返回</el-button>
					</td>
				</tr>
			</table>
			<table width="90%" border="1" cellpadding=0 cellspacing=1
				   bordercolorlight=#848284 bordercolordark=#eeeeee
				   class="TABLE_STYLE1">
				<tr>

					<td class="TD_STYLE2">
						<el-form-item label="角色名称" prop="RolesName">
							<el-input v-model="RolesName" style="width: 200px;"></el-input>
						</el-form-item>
					</td>

					<td class="TD_STYLE2">
						<el-form-item label="角色说明" prop="RolesInstruction">
							<el-input v-model="RolesInstruction" style="width: 200px;"></el-input>
						</el-form-item>
					</td>
				</tr>
				<tr>

					<td class="TD_STYLE2" colspan="2">
						<el-form-item label="角色是否可用" prop="RolesIf">
							<el-select v-model="js" placeholder="请选择">
								<el-option label="是" value="1"></el-option>
								<el-option label="否" value="0"></el-option>
							</el-select>
						</el-form-item>
					</td>
				</tr>
			</table>
		</el-form>
	</div>
	<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
	<script src="https://unpkg.com/vue@3"></script>
	<!-- 引入Element Plus -->
	<script src="https://unpkg.com/element-plus"></script>
	<!-- 引入axios -->
	<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	<script>
		const app = Vue.createApp({
			data() {
				return {
					js: '',//角色
					RolesName: '',//角色名称
					RolesInstruction: '',//角色说明
					RolesIf: '',//是否可用
				}
			}, mounted() {

			},
			methods: {
				submitForm() {
					const vm = this;
					const updatedData = {
						rolesName:this.RolesName,
						rolesInstruction:this.RolesInstruction,
						rolesIf:this.js,
					};
					axios.get("/User/AddRoles", {
						params: updatedData
					})
						.then(function (response) {
							if (response.data) {
								alert("添加成功！");
								window.location.href = "/User/rolemanagement";//页面跳转
							} else {
								alert("添加失败！！");
							}
						})
						.catch(function (error) {
							console.error(error);
							alert("请求失败");
						});
				},
				qc() {
					window.location.href = "/User/rolemanagement";//页面跳转
				},
			}
		})
		app.use(ElementPlus);

		// 挂载应用程序到页面上
		app.mount("#app");
	</script>
</body>
</html>